package com.blogspot.security.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.blogspot.security.domain.ApplicationRole;
import com.blogspot.security.domain.ApplicationUser;
import com.blogspot.security.enumtype.Status;
import com.blogspot.security.service.UserDetailsRegisterService;

@Controller
@RequestMapping("/login")
public class LoginController {

    private Logger logger = LoggerFactory.getLogger(LoginController.class);
    
	@Autowired
	UserDetailsRegisterService userDetailsRegisterService;
    /**
     * LOGIN登入頁面
     * @param model 
     * @return String 
     */
    @RequestMapping(method = RequestMethod.GET)
    public String getPage(Model model) {
        logger.error("====登入頁面====");
//    	ApplicationUser user = new ApplicationUser();
//    	user.setUserName("AllanSung");
//    	user.setPassword("1234");
//    	user.setStatus(Status.A);
//    	ApplicationRole ar = new ApplicationRole();
//    	ar.setId((long) 1);
//    	ar.setRoleAuthName("App_Admin");
//    	user.setRole(ar);
//    	userDetailsRegisterService.insertApplicationUser(user);
        return "/login";
    }
}